package com.example.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.mapper.UserMapper;
import com.example.demo.module.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1")
@Slf4j
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @CrossOrigin
    @RequestMapping(value = "/user",method = RequestMethod.GET)
    public User getUser(){
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("usercode","444");
        return userMapper.selectOne(queryWrapper);
    }
}
